<template>
	<view class="pages-equity-message-list">
		<x-list ref="xlist" @load="load">
			<template #item="{ item }">
				<view class="list-item"
					@click="handleToPage('/pages/equity-sub/message/detail', { message_id: item.id })">
					<view class="header">
						<view class="notice-title">
							<text class="u-line-1">{{ item.notice.title }}</text>
						</view>
						<view class="is-reply-box">
							<text :class="`${item.is_reply ? 'text-green' : 'text-red'}`">{{ item.is_reply_text
								}}</text>
						</view>
					</view>
					<view class="center">
						<text>Q: {{ item.last_message.content }}</text>
					</view>
					<view class="footer">
						<text>{{ item.last_message.create_time }}</text>
					</view>
				</view>
			</template>
		</x-list>
	</view>
</template>

<script>
	import dataList from '@/data/list.json'
	export default {
		data() {
			return {
			}
		},
		onLoad() {

		},
		methods: {
			load({ page, pageSize }) {
				this.$refs.xlist.success(dataList.data)
				// this.$refs.xlist.fail()
			},
			handleToPage(path, params = {}) {
				uni.$u.route({
					url: path,
					params: params
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.pages-equity-message-list {
		background-color: #f8f8f8;

		.list-item {
			margin: 20rpx 30rpx;
			padding: 24rpx;
			background: #FFFFFF;
			border-radius: 20rpx;

			.header {
				display: flex;
				justify-content: space-between;
				font-weight: 400;
				font-size: 28rpx;
				line-height: 67rpx;

				.notice-title {
					width: calc(100% - 84rpx);
					font-weight: 500;
					font-size: 32rpx;
					color: #333333;
				}

				.is-reply-box {
					width: 84rpx;

					.text-red {
						color: #FF0000;
					}

					.text-green {
						color: #2DCC75;
					}
				}
			}

			.center {
				font-weight: 400;
				font-size: 28rpx;
				color: #333333;
				line-height: 67rpx;
			}

			.footer {
				font-weight: 400;
				font-size: 24rpx;
				color: #666666;
				line-height: 67rpx;
				text-align: right;
			}
		}
	}
</style>
